/*****************************************************************************
 *   Copyright(C)2009-2022 by VSF Team                                       *
 *                                                                           *
 *  Licensed under the Apache License, Version 2.0 (the "License");          *
 *  you may not use this file except in compliance with the License.         *
 *  You may obtain a copy of the License at                                  *
 *                                                                           *
 *     http://www.apache.org/licenses/LICENSE-2.0                            *
 *                                                                           *
 *  Unless required by applicable law or agreed to in writing, software      *
 *  distributed under the License is distributed on an "AS IS" BASIS,        *
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 *  See the License for the specific language governing permissions and      *
 *  limitations under the License.                                           *
 *                                                                           *
 ****************************************************************************/


//! \note User Level Application Configuration

#ifndef __VSF_USR_CFG_CMEM7_H__
#define __VSF_USR_CFG_CMEM7_H__

/*============================ INCLUDES ======================================*/
/*============================ MACROS ========================================*/

// Application configure
#   define APP_USE_USBH_DEMO                            DISABLED
#   define APP_USE_USBD_DEMO                            ENABLED
#       define APP_USE_USBD_DFU_DEMO                    ENABLED

// Kernel configure

#define VSF_DRIVER_HEADER                           \
    "../../../source/hal/driver/hme/driver.h"

#define VSF_SYSTIMER_CFG_IMPL_MODE                      VSF_SYSTIMER_IMPL_NONE
#define VSF_SYSTIMER_FREQ                               (266666667)

#define VSF_OS_CFG_ADD_EVTQ_TO_IDLE                     DISABLED
#define VSF_ARCH_CFG_CALLSTACK_TRACE                    DISABLED

#define VSF_KERNEL_CFG_EDA_SUPPORT_TIMER                DISABLED
#define VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER           DISABLED
#define VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY         DISABLED
#define VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL             DISABLED
#define VSF_KERNEL_CFG_SUPPORT_THREAD                   DISABLED
#define VSF_KERNEL_CFG_SUPPORT_SYNC                     DISABLED

#define VSF_HAL_USE_FLASH                               DISABLED
#define VSF_HAL_USE_GPIO                                DISABLED

// component configure
#define VSF_USE_POOL                                    DISABLED
#define VSF_USE_HEAP                                    DISABLED 
#   define VSF_HEAP_CFG_MCB_MAGIC_EN                    DISABLED
#   define VSF_HEAP_SIZE                                (32 * 1024)

// VSF_USE_USB_DEVICE will be enabled if target chip supports USBD
#define VSF_USE_USB_HOST                              DISABLED
//#define VSF_USE_USB_DEVICE                              ENABLED
#   define VSF_USBD_CFG_USE_EDA                         ENABLED
#   define VSF_USBD_USE_DFU                             ENABLED
#   define APP_CFG_USBD_VID                             0xA7A8
#   define APP_CFG_USBD_PID                             0x2348

#define VSF_ASSERT(...)

//extern void VSF_DEBUG_STREAM_POLL(void);
//#define VSF_ASSERT(...)                                 if (!(__VA_ARGS__)) { while(1);};
//#define VSF_USB_ASSERT(...)                             if (!(__VA_ARGS__)) { vsf_trace_debug( "%s:%u %s"# __VA_ARGS__ VSF_TRACE_CFG_LINEEND, __FILE__, __LINE__, __FUNCTION__);  while(1) { VSF_DEBUG_STREAM_POLL(); }};

#if APP_USE_USBD_DEMO == ENABLED
#   define VSF_USE_USB_DEVICE                           ENABLED
#       define VSF_USBD_USE_DCD_DWCOTG                  ENABLED
#       define VSF_USBD_CFG_EDA_PRIORITY                vsf_prio_0
#       define VSF_USBD_CFG_HW_PRIORITY                 vsf_arch_prio_0
#       define VSF_USBD_CFG_TRACE                       DISABLED
#       define VSF_USBD_CFG_TRACE_EVT                   DISABLED

#       define USRAPP_CFG_USBD_SPEED                    USB_SPEED_FULL
#       define USRAPP_USBD_DWCOTG_CFG_ULPI_EN           true
#       define USRAPP_USBD_DWCOTG_CFG_UTMI_EN           false
#       define USRAPP_USBD_DWCOTG_CFG_VBUS_EN           false
#       define USRAPP_USBD_DWCOTG_CFG_DMA_EN            false
#endif



#define APP_CFG_USBD_VID                                0xA7A8
#define APP_CFG_USBD_PID                                0x2348
#define APP_CFG_USBD_EP0_SIZE                           64
#define APP_CFG_USBD_VENDOR_STR                         u"vsf"
#define APP_CFG_USBD_PRODUCT_STR                        u"vsf_dfu"
#define APP_CFG_USBD_SERIAL_STR                         u"0000"
#define APP_CFG_USBD_FUN_STR                            u"VSF-DFU"
#define APP_CFG_USBD_WEBUSB_URL                         "devanlai.github.io/webdfu/dfu-util/"

#define APP_CFG_USBD_SPEED                              USB_DC_SPEED_HIGH
//#define APP_CFG_USBD_SPEED                              USB_DC_SPEED_FULL

#define APP_CFG_USBD_DFU_TRANSFER_SIZE                  256
#define APP_CFG_USBD_DFU_PROTOCOL                       USB_DFU_PROTOCOL_DFU

#define APP_CFG_DFU_BIN_SIZE                            (16 * 1024)
#define APP_CFG_DFU_BIN_BASEADDR                        __dfu_bin


/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/


#endif      // __VSF_USR_CFG_CMEM7_H__
/* EOF */
